#ifndef MODULESFACTORY_H
#define MODULESFACTORY_H

#include "devcommon_global.h"

#include <QObject>
#include <QWidget>

class ModulesFactoryPrivate;
class DEVCOMMONSHARED_EXPORT ModulesFactory : public QObject
{
    Q_OBJECT
    static ModulesFactoryPrivate* d_ptr;
    Q_DECLARE_PRIVATE(ModulesFactory)
public:
    explicit ModulesFactory(QObject *parent = nullptr);

    static void setSearchPath(const QString& path);
    static QWidget* createModule(const QString& name);
};

#define STRING_HELP(x) QString(#x)
#define STRING(x) STRING_HELP(x)
#define BINARY_BASE(name) #name
#define BINARY_SUFFIC .so
#define BINARY_PREFIX lib
#define BINARY_PATH_SPLIT /
#define BINARY_FILE_1(name) name+STRING(BINARY_SUFFIC)
#define BINARY_FILE_2(name) STRING(BINARY_PREFIX)+name
#define BINARY_FILE_3(name) STRING(BINARY_PREFIX)+BINARY_FILE_1(name)
#define BINARY_FILE_4(name) name+STRING(BINARY_PATH_SPLIT)+STRING(BINARY_PREFIX)+BINARY_FILE_1(name)
#define BINARY_FILE(path,name) path+name

#endif // MODULESFACTORY_H
